import request from '@/utils/request';
// import type { VepParameter, VepResult } from 'api/types/vep';
// import type { GepParameter, GepResult } from 'api/types/gep';


const getHomepageData = async (year:number, district:string) => {
    try {
        const response = await request.get('/api/homepage-data/homepage', {
            params: {
                year,
                district
            }
        });
        console.log("getHomepageData",response.data);
        return response.data; // 返回的数据是 [{name: '河口镇', value: 100}, ...]
    } catch (error) {
        ElMessage.error('Failed to fetch data');
        console.error('Error:', error);
        return [];
    }
};

export const getHomepageMapData = async (year:number, district:string) => {
    try {
        const response = await request.get('/api/homepage-data/homepageMap', {
            params: {
                year,
                district
            }
        });
        console.log("getHomepageMapData",response.data);
        return response.data; // 返回的数据是 [{name: '河口镇', value: 100}, ...]
    } catch (error) {
        ElMessage.error('Failed to fetch data');
        console.error('Error:', error);
        return [];
    }
};


export default getHomepageData;
